package a4ny;

public class Bigram implements Comparable{
	public String variable;
	public String condition;
	
	public Bigram(String variable, String condition){
		this.variable = variable;
		this.condition = condition;
	}
	
//	public boolean equals(Object other){
//		if(variable == ((Bigram)other).variable && condition == ((Bigram)other).condition){
//			return true;
//		}else{
//			return false;
//		}
//	}
	
	public int compareTo(Object other){
		if (variable.compareTo(((Bigram)other).variable) != 0){
			return variable.compareTo(((Bigram)other).variable);
		}else if(condition.compareTo(((Bigram)other).condition) != 0){
			return condition.compareTo(((Bigram)other).condition);
		}else{
			return 0;
		}
		
//	    if(variable == ((Bigram)other).variable && condition == ((Bigram)other).condition)
//	        return 0;	    	
//	    else if (variable == ((Bigram)other).variable && condition.compareTo(((Bigram)other).condition) == 1)
//	        return 1;
//	    else if (variable == ((Bigram)other).variable && condition.compareTo(((Bigram)other).condition) == -1)
//	        return -1;
//	    else if (variable.compareTo(((Bigram)other).variable) == 1)
//	        return 1;
//	    else 
//	        return -1;
	}
}
